/*
 * Copyright (c) 2016-2018 Hunan CNBOT Co., Ltd. All Rights Reserved.
 * FileName: CnbotsPriorityRunnable.java
 * @author: Clintonfang
 * @date: 18-12-12 上午4:17
 * @version: 1.0
 */

package com.cnbot.toolkit.threadpool.priority;

/**
 * 优先级线程
 *
 * @author Clintonfang
 * @date 2018-12-12 04:22:44
 */
public class CnbotsPriorityRunnable implements Runnable {

    /**
     * 任务优先级
     */
    public final Priority priority;
    /**
     * 任务真正执行者
     */
    private final Runnable runnable;
    /**
     * 任务唯一标示
     */
    protected long seq;

    public CnbotsPriorityRunnable(Priority priority, Runnable runnable) {
        this.priority = priority == null ? Priority.NORMAL : priority;
        this.runnable = runnable;
    }

    @Override
    public final void run() {
        this.runnable.run();
    }
}
